//
//  AddressTableViewCell.m
//  JiuJiuShangCheng
//
//  Created by jiujiukeji on 2018/7/9.
//  Copyright © 2018年 jiujiukeji. All rights reserved.
//

#import "AddressTableViewCell.h"

@implementation AddressTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI
{
    WeakSelf
    self.nameLB = [UILabel labelWithText:@"联系人姓名" textColor:UIColorFromRGB(0x323232) fontSize:15];
    [_nameLB sizeToFit];
    [self addSubview:_nameLB];
    [_nameLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(rateWidth(30));
        make.top.equalTo(self).offset(rateHeight(30));
    }];
    
    self.phoneLB = [UILabel labelWithText:@"18337876543" textColor:UIColorFromRGB(0x323232) fontSize:15];
    [_phoneLB sizeToFit];
    [self addSubview:_phoneLB];
    [_phoneLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLB.mas_right).offset(rateWidth(40));
        make.centerY.equalTo(self.nameLB);
    }];
    
    self.addressLB = [UILabel labelWithText:@"天津市河西区大营门街道国际贸易中心" textColor:UIColorFromRGB(0x909090) fontSize:13];
    _addressLB.numberOfLines = 0;
    [self addSubview:_addressLB];
    [_addressLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLB);
        make.width.mas_lessThanOrEqualTo(@(rateWidth(640)));
        make.top.equalTo(weakSelf.nameLB.mas_bottom).offset(rateHeight(20));
    }];
    
    UIView *bottomV = [[UIView alloc] init];
    bottomV.backgroundColor = UIColorWhite;
    [self addSubview:bottomV];
    [bottomV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.left.right.equalTo(self);
        make.height.equalTo(@(rateHeight(80)));
    }];
    UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, rateHeight(1))];
    line.backgroundColor = globalGray;
    [bottomV addSubview:line];
    
    self.selectBtn = [UIButton buttonWithTitle:@"  默认地址" fontSize:13 titleColor:UIColorFromRGB(0x909090) background:kClearColor cornerRadius:0]; // 默认地址
    [_selectBtn setImage:UIImageNamed(@"shemoren") forState:(UIControlStateNormal)]; // shemoren1
    [_selectBtn sizeToFit];
    [bottomV addSubview:_selectBtn];
    [_selectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(rateWidth(30));
        make.centerY.equalTo(bottomV);
    }];
    
    self.deleteBtn = [UIButton buttonWithTitle:@" 删除" fontSize:13 titleColor:UIColorFromRGB(0x909090) background:kClearColor cornerRadius:0];
    [_deleteBtn setImage:UIImageNamed(@"shanchuDizhi") forState:(UIControlStateNormal)];
    [_deleteBtn sizeToFit];
    [bottomV addSubview:_deleteBtn];
    [_deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-rateWidth(48));
        make.centerY.equalTo(bottomV);
    }];
    
    self.editBtn = [UIButton buttonWithTitle:@" 编辑" fontSize:13 titleColor:UIColorFromRGB(0x909090) background:kClearColor cornerRadius:0];
    [_editBtn setImage:UIImageNamed(@"addressbianji") forState:(UIControlStateNormal)];
    [_editBtn sizeToFit];
    [bottomV addSubview:_editBtn];
    [_editBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.deleteBtn.mas_left).offset(-rateWidth(48));
        make.centerY.equalTo(bottomV);
    }];
    
}

@end
